<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_JS运算符</title>
</head>
<body>
<script>
    console.log(6/3);
    console.log(3/2);  //1.5
    //如果比较运算符任意一边有数字,会先转成数字再比较
    console.log(3>10);  //false
    console.log(3>'10');  //false
    console.log('3'>10);  //false
    //如果比较运算符两边都是字符，比较的是编码
    console.log('超'.charCodeAt());  //36229
    console.log('宇'.charCodeAt());  //23431
    console.log('超'>'宇');  //true
    console.log('3'>'10');  //true
    console.log('3'.charCodeAt(0));  //true  51
    console.log('10'.charCodeAt(2));  //true  49  按元素的下标对应获取相应该数字对应的编码，只有0~9的编码

    let a = 1;
    let b = true;
    console.log(a == b);  //松散比较运算符  true
    console.log(a === b);  //严格比较运算符 false  先比较数据类型，在比较值是否相等

    let c = 0;
    console.log(c == 0? 'YES': 'NO' );  //YES
    console.log(c = 0? 'YES': 'NO' );  //NO  一个=是赋值，c被赋值为0，转为布尔是false，所以为NO

</script>
</body>
</html>